const mongoose = require('mongoose')
// 创建约束
const schema = new mongoose.Schema({
	username: {type:String, unique:true},
	password: {
		type: String,
		select:false,
		set(val){
			return require('bcrypt').hashSync(val,10)
		}},
	role: {type: String},
	editor: {type: String}
})
// 输出具备约束的model模型
module.exports = mongoose.model('AdminUser', schema)
